import 'package:json_annotation/json_annotation.dart';
import 'package:gzmall_app/model/order_item.dart';

part 'order.g.dart';

@JsonSerializable()
class Order extends Object {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'trade_no')
  String tradeNo;

  @JsonKey(name: 'total_fee')
  String totalFee;

  @JsonKey(name: 'express_fee')
  String expressFee;

  @JsonKey(name: 'state')
  String state;

  @JsonKey(name: 'state_zh')
  String stateZh;

  @JsonKey(name: 'address')
  String address;

  @JsonKey(name: 'buyer_phone')
  String buyerPhone;

  @JsonKey(name: 'buyer_name')
  String buyerName;

  @JsonKey(name: 'created_at')
  String createdAt;

  @JsonKey(name: 'created_time_at')
  String createdTimeAt;

  @JsonKey(name: 'items')
  List<OrderItem> items;

  @JsonKey(name: 'is_evaluated')
  bool isEvaluated;

  @JsonKey(name: 'service_url')
  String serviceUrl;

  @JsonKey(name: 'shop_name')
  String shopName;

  Order(
    this.id,
    this.tradeNo,
    this.totalFee,
    this.expressFee,
    this.state,
    this.stateZh,
    this.address,
    this.buyerPhone,
    this.buyerName,
    this.createdAt,
    this.createdTimeAt,
    this.items,
    this.isEvaluated,
    this.serviceUrl,
    this.shopName,
  );

  factory Order.fromJson(Map<String, dynamic> srcJson) =>
      _$OrderFromJson(srcJson);
}
